local border_radius = require "border_radius"
local division = require 'division'
local vec2 = require "vec2"
local rect = require "rect"
local division = require "division"
local color = require "color"
local os = require "os"
local ui = require "ui"
local padding = require "padding"

if os.getenv("LOCAL_LUA_DEBUGGER_VSCODE") == "1" then
    require("lldebugger").start()
end

local entities = {}

ui.run(ui.list {
    direction = ui.layout_direction.horizontal,
    children = {
        ui.decorated_box { color = color.WHITE },
        ui.decorated_box { color = color.BLUE },
        ui.container {
            background_color = color.RED,
            child = ui.view_builder(function()
                local time = os.date()
                return ui.text {
                    text = tostring(time),
                    font_size = 20,
                    color = color.WHITE
                }
            end)
        }
    }
})


division:add_update_listener(function()
    ui.rebuild()
end)

division:add_destroy_listener(function()
    for _, e in ipairs(entities) do
        division:destroy_entity(e)
    end
end)
